package cn.yj.core.geo;

import cn.yj.config.annotation.Anonymous;
import cn.yj.config.web.AppBaseController;
import cn.yj.entity.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 永健
 * @since 2021-05-05 21:11
 */
@RestController
@RequestMapping("/geo")
public class GeoController extends AppBaseController {
    @Resource
    private GeoHandler handler;

    @GetMapping("lngToAddress")
    @Anonymous
    public R lngToAddress(String locations) throws Exception {
        return success(handler.getCityByLocation(handler.coordinateConvert(Geo.Cordons.gps,locations)));
    }
    /**
     * 获取具体的信息
     * @param locations
     * @return
     * @throws Exception
     */
    @GetMapping("lngToAddressDetailList")
    @Anonymous
    public R lngToAddressDetailList(String locations) throws Exception {
        return success(handler.coordToAddress(handler.coordinateConvert(Geo.Cordons.gps,locations)));
    }
}
